package com.china.bike.dao.impl;

import com.china.bike.dao.BikeInfoDao;
import com.china.bike.dto.BikeListParam;
import com.china.bike.entity.BikeInfo;
import com.china.bike.entity.BikeUseRecord;
import com.china.bike.mapper.BikeInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public class BikeInfoDaoImpl implements BikeInfoDao {

    @Autowired
    private BikeInfoMapper bikeInfoMapper;

    @Override
    public int saveBikeInfo(List<BikeInfo> bikeInfoList) {
        return bikeInfoMapper.saveBikeInfo(bikeInfoList);
    }

    @Override
    public int updateBikeStatus(BikeInfo bikeInfo) {
        return bikeInfoMapper.updateBikeStatus(bikeInfo);
    }

    @Override
    public List<BikeInfo> listBikes(BikeListParam bikeListParam) {
        return bikeInfoMapper.listBikes(bikeListParam);
    }

    @Override
    public Integer listBikeCount(BikeListParam bikeListParam) {
        return bikeInfoMapper.listBikeCount(bikeListParam);
    }

    @Override
    public List<BikeUseRecord> getBikeUseRecord(List<Long> bikeIds) {
        return bikeInfoMapper.getBikeUseRecord(bikeIds);
    }

    @Override
    public List<Map<String, String>> getBikeUseRecordCountByBikeId(List<Long> bikeIds) {
        return bikeInfoMapper.getBikeUseRecordCountByBikeId(bikeIds);
    }

    @Override
    public List<BikeInfo> listBikes(Integer status) {
        return null;
    }

    @Override
    public void driveBike(BikeUseRecord bikeUseRecord) {
        bikeInfoMapper.driveBike(bikeUseRecord);
    }

    @Override
    public List<BikeUseRecord> getBikeByUserId(Long userId, Integer start, Integer limit) {
        return bikeInfoMapper.getBikeByUserId(userId, start, limit);
    }

    @Override
    public void lockBike(BikeUseRecord bikeUseRecord) {
        bikeInfoMapper.lockBike(bikeUseRecord);
    }

    @Override
    public int getBikeByUserIdCount(Long userId) {
        return bikeInfoMapper.getBikeByUserIdCount(userId);
    }

    @Override
    public int deleteBike(String bikeNum) {
        return bikeInfoMapper.deleteBike(bikeNum);
    }
}
